<template>
  <view class="container relative">
    <image src="/static/images/home/home_bg.png" mode="widthFix" style="width: 100%;" :style="{top: marginTops+'px'}"
      class="absolute"></image>
    <!-- 淡出层 -->
    <!-- <view class="mask4" :style="{width:system.windowWidth*2 + 'upx', height:system.windowHeight}">
			
		</view> -->
    <!-- 内置广告位置 -->
    <view v-if="ad">
      <view class="mask" :class="show3" :style="{ backgroundColor: adv.style.background,opacity: adv.style.opacity }"
        @click.stop.prevent="hide1"></view>
      <view class="mask" :class="show3" v-if="adv.status == '1' && ad" style="width: 100%;height: 100%;z-index: 9999;">
        <swiper circular autoplay duration="800" @change="swiperChange" style="width: 750upx;height: 100%;">
          <swiper-item v-for="(item, index) in adv.data" :key="index" style="width: 750upx;height: 100%;">
            <image :src="item.imgurl" @click="jumptomenu(item)" style="width: 750upx;height: 100%;" />
          </swiper-item>
        </swiper>
        <view
          style="position: fixed;z-index: 33;top: 60upx;right: 60upx;background-color: rgba(100,100,100,0.3);height: 60upx;line-height: 60upx;border-radius: 40upx;width: 130upx;">
          <uni-countdown :second="Number(autoclose)"
            style="position: absolute;top: -35upx;left: -20upx;background: transpant;z-index: 0;"></uni-countdown>
          <view style="position: absolute;right: 20upx;top: 6upx;color: #FFFFFF;" @click="hide1">关闭</view>
        </view>
      </view>
      <view class="mask" :class="show3" v-if="adv.status == '2' || adv.status == '3'"
        style="width: 100%;height: 100%;z-index: 9999;">
        <swiper circular autoplay duration="800" @change="swiperChange"
          style="width:500upx;height: 1500upx;top: 50%;left: 50%;transform: translate(-50%, -50%);position: absolute;">
          <swiper-item v-for="(item, index) in adv.data" :key="index">
            <image :src="item.imgurl" @click="jumptomenu(item)"
              style="width:500upx;top: 50%;left: 50%;transform: translate(-50%, -50%);position: absolute;"
              mode="widthFix" />
          </swiper-item>
        </swiper>
        <view
          style="position: fixed;z-index: 33;top: 60upx;right: 60upx;height: 60upx;line-height: 60upx;border-radius: 40upx;width: 130upx;"
          v-if="adv.status == '3'">
          <image src="../../static/close.png"
            style="position: absolute;right: 20upx;top: 60upx;width: 70upx;height: 70upx;" @click="hide1" mode="">
          </image>
        </view>
        <view style="position: fixed;z-index: 33;bottom: 220upx;left: 50%;" v-if="adv.status == '2'">
          <image src="../../static/close.png"
            style="position: absolute;left: -45upx;top: 0upx;width: 90upx;height: 90upx;" @click="hide1" mode="">
          </image>
        </view>
      </view>
    </view>

    <!-- search头部搜索框 -->
    <u-navbar ref="navbars" :is-back="false" title=" " :background="{backgroundColor: '#125663'}" :height="navbarHeight"
      :border-bottom="false">
      <view class="u-f-ac u-f-jsb navbars">
        <view class="u-f-ajc u-f-column">
          <u-icon name="/static/images/tabbar/fujin_active.ico" size="34" color="#C18659"></u-icon>
          <view>附近</view>
        </view>
        <view style="margin: 0 30rpx;" class="u-f1">
          <u-search placeholder="搜索商品" :show-action="false" border-color="#eee" bg-color="#FFFFFF" disabled
            @click="$u.route(`/pages/goods/goods?cate=0`)"></u-search>
        </view>
        <view class="u-f-ac">
          <view class="u-f-ajc u-f-column" style="margin-right: 20rpx;" @click="$u.route('/pages/cart/cart')">
            <u-icon name="/static/images/tabbar/cart_active.ico" size="34" color="#C18659"></u-icon>
            <view>购物车</view>
          </view>
          <view class="u-f-ajc u-f-column" @click="$u.route('/pages/shop/category')">
            <u-icon name="/static/images/tabbar/category_active.ico" size="34" color="#C18659"></u-icon>
            <view>分类</view>
          </view>
        </view>
      </view>
    </u-navbar>

    <view v-for="(res,index) in data" :key="index">
      <!-- 头部轮播 -->
      <view v-if="res.id == 'banner'">
        <view class="carousel-section">
          <image src="/static/images/home/shanzi.png" mode="widthFix" class="abso_image"></image>
          <!-- <view class="titleNview-placing"></view> -->
          <!-- <view class="titleNview-background" :style="{backgroundColor:titleNViewBackground}"></view> -->
          <swiper class="carousel" circular autoplay duration="1000" @change="swiperChange">
            <swiper-item v-for="(item, index) in res.data" :key="index" class="carousel-item">
              <image :src="item.imgurl" @click="jumptomenu(item)" />
            </swiper-item>
          </swiper>
          <view class="swiper-dots">
            <text class="num">{{swiperCurrent+1}}</text>
            <text class="sign">/</text>
            <text class="num">{{swiperLength}}</text>
          </view>
        </view>
      </view>

      <!-- menu2 -->
      <view v-if="res.id == 'menu2'">
        <view class="tab_choose">
          <text class="menu_son">
            <text class="iconfont">&#xe654; </text>
            <text class="padleft"> 自购轻松省</text>
          </text>
          <text class="menu_son">
            <text class="iconfont">&#xe654; </text>
            <text class="padleft"> 分享简单赚</text>
          </text>
          <text class="menu_son">
            <text class="iconfont">&#xe654;</text>
            <text class="padleft"> 百分百正品</text>
          </text>
        </view>
      </view>
      <!-- blank -->
      <view v-if="res.id == 'blank'">
        <view :style="{background:res.style.background,height:res.style.height *2 + 'upx'}"></view>
      </view>
      <!-- title -->
      <view v-if="res.id == 'title'">
        <view
          :style="{'text-align':res.style.textalign,'padding-top':res.style.paddingtop+'px','padding-bottom':res.style.paddingtop+'px','padding-left':res.style.paddingleft+'px','padding-right':res.style.paddingleft+'px','background':res.style.background}">
          <text :style="{color:res.style.color,'font-size':res.style.fontsize*2+'upx'}"
            v-cloak>{{res.params.title}}</text>
        </view>
      </view>
      <!-- menu -->
      <view v-if="res.id == 'menu'">
        <swiper v-if="res.data_temp" indicator-dots="true" style="height: 222upx;">
          <swiper-item v-for="(menu,index1) in res.data_temp" :key="index1" class="webkit">
            <view v-for="(item,index2) in menu" :key="index2" style="width: 150upx;padding: 0 0;" @click="jump"
              data-src='item.linkurl'>
              <image :src="item.imgurl" style="width: 120upx;height: 120upx;margin: 0 auto;display: block;"></image>
              <text
                style="display: block;text-align: center;font-size: 24upx;padding: 8upx;position: relative;z-index: 99;color: #154473;"
                :style="{color:item.color}">{{item.text}}</text>
            </view>
          </swiper-item>
        </swiper>
        <view v-else class="webkit flexbox">
          <view v-for="(item,i) in res.data" :key="i" :style="{width: 100 /res.style.rownum +'%'}"
            @click="jumptomenu(item)" style="padding: 0 0;" class="flexboxson">
            <image :src="item.imgurl" style="width: 120upx;height: 120upx;margin: 0 auto;display: block;"></image>
            <text
              style="display: block;text-align: center;font-size: 24upx;padding: 8upx;position: relative;z-index: 99;color: #154473;"
              v-cloak>{{item.text}}</text>
          </view>
        </view>
      </view>
      <!-- notice  公告-->
      <view v-if="res.id == 'notice'">
        <view class="uni-swiper-msg" style="width: 675upx;padding-left: 30upx;margin-top: 10rpx;">
          <!-- <view class="uni-swiper-msg-icon" style="width: 70upx;">
						<image :src="res.params.iconurl"  mode="widthFix" style="width: 70upx;height: 28upx;margin-top: 12upx;padding-right: 10upx;border-right: 2upx solid #e2e2e2;"></image>
						<view style="color: #b25415;padding-left: 10upx;">热点</view>
					</view> -->
          <image src="/static/images/home/noties.png" style="width: 100upx;margin-right: 12px;" mode="widthFix"></image>
          <swiper vertical="true" autoplay="true" circular="true" interval="3000" class="flex"
            style="margin-top: 6rpx;">
            <swiper-item v-for="(item, index3) in res.data" :key="index3" style="line-height: 45upx;height: 45upx;">
              <navigator :style="{color:res.style.color}" style="font-size: 24upx;" class="ellipsis-1">{{item.title}}
              </navigator>
            </swiper-item>
          </swiper>
        </view>
      </view>

      <!-- picturew -->
      <!-- <view v-if="res.id == 'picturew'">
				<view class="webkit" style="padding: 0 8upx;margin-bottom: 20upx;">
					<image v-for="(item,index4) in res.data" :key="index4" :src="item.imgurl" mode="" :class="'pic'+res.params.row" :style="{'padding-left':res.style.paddingleft+'px','padding-right':res.style.paddingleft+'px','padding-top':res.style.paddingtop+'px','padding-bottom':res.style.paddingtop+'px'}" style="height: 184upx;"></image>
				</view>
			</view> -->

      <!-- picturew 橱窗布局 -->
      <view v-if="picturew_row == '1'">
        <view v-if="res.id == 'picturew'" class="p_father">
          <view class="p_left">
            <image :src="picturew[0].imgurl" @click="jumptomenu(picturew[0])"></image>
            <!-- @click="jump_1" -->
          </view>
          <view class="p_right">
            <view class="img_top">
              <image :src="picturew[1].imgurl" @click="jumptomenu(picturew[1])"></image>
            </view>
            <view class="img_bottom" v-if="picturew[2]">
              <view>
                <image :src="picturew[2].imgurl" @click="jumptomenu(picturew[2])"></image>
              </view>
              <view v-if="picturew[3]">
                <image :src="picturew[3].imgurl" @click="jumptomenu(picturew[3])"></image>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view v-if="picturew_row == '4'">
        <view v-if="res.id == 'picturew'" style="display: flex;">
          <view style="width: 400upx;height: 200upx;margin: 5upx;" v-for="(item,index4) in res.data" :key="index4">
            <image :src="item.imgurl" style="width: 100%;height: 100%;" @click="jumptomenu(item)"></image>
          </view>
        </view>
      </view>
      <!-- 堆积两列 -->
      <view v-if="picturew_row == '2'">
        <view v-if="res.id == 'picturew'" style="">
          <view style="width: 360upx;height: 200upx;margin: 5upx;display: inline-block;"
            v-for="(item,index4) in res.data" :key="index4">
            <image :src="item.imgurl" style="width: 100%;height: 100%;" @click="jumptomenu(item)"></image>
          </view>
        </view>
      </view>
      <!-- 堆积三列 -->
      <view v-if="picturew_row == '3'">
        <view v-if="res.id == 'picturew'" style="">
          <view class="u-f-ac u-f-jse">
            <view style="width: 210upx;height: 310upx;margin: 5upx;display: inline-block;"
              v-for="(item,index4) in res.data" :key="index4">
              <image :src="item.imgurl" mode="widthFix" style="width: 100%;height: 100%;" @click="jumptomenu(item)"></image>
            </view>
          </view>
          <!-- <view style="position: relative;width: 750upx;height: 100upx;text-align: center;margin: 20rpx 0;">
            <view style="position: absolute;top: 0;">
              <image style="width: 750upx;height: 100upx;" src="/static/images/home/home_dibu.png" mode=""></image>
            </view>
            <view
              style="position: absolute;top: 20upx;left: 10%; height: 80upx;line-height: 80upx;text-align: center;color:#333  ;display: flex;">
              <view>
                <image style="width: 50upx;height: 50upx;" src="../../static/jin.png" mode=""></image>
              </view>
              <view>
                <text style="color: #eee;margin-left: 30upx;">当前全网</text> 扶贫基金总量 <text
                  style="margin-left: 100upx;">{{helpmoney}}</text>
              </view>
            </view>
          </view> -->
        </view>
      </view>


      <!-- picture -->
      <view v-if="res.id == 'picture'" style="overflow: hidden;">
        <image v-for="(item,index5) in res.data" :key="index5" :src="item.imgurl" style="width: 100%;"
          :style="{'padding-right':res.style.paddingleft * 2 +'upx','padding-top':res.style.paddingtop * 2 +'upx','padding-bottom':res.style.paddingtop * 2 +'upx'}"
          @click="jumptomenu(item)" mode="widthFix"></image>
      </view>
      <!-- goods 商品主题场列表-->
      <view v-if="res.id == 'goods'" class="clear" :class="res.style.liststyle">
        <view v-for="(item,i) in res.data" :key="i" class="item" @click="jumpgoods" :data-id='item.gid'>
          <image class="triangle" :src="item.thumb"></image>
          <view class="detail">
            <view class="name" :style="{color:res.style.titlecolor}">{{item.title}}</view>
            <!-- style="border-bottom: 1upx solid rgba(0,0,0,0.1);" -->
            <view class='productprice' v-if="res.params.showproductprice == 1"
              :style="{color:res.style.productpricecolor}" style="position: relative;">
              <text style="text-decoration:line-through;">{{res.params.productpricetext}}{{item.productprice}}</text>
              <text v-if="res.params.showsales != 1" style="position: absolute;right: 0;top: 0;">库存{{item.total}}</text>
            </view>
            <view class='sale' v-if="res.params.showsales == 1" :style="{color:res.style.salescolor}"
              style="position: relative;">
              <text>{{res.params.salestext}}{{item.sales}}</text>
              <text style="position: absolute;right: 0;top: 0;">库存{{item.total}}</text>
            </view>
            <view class="price webkit" v-if="res.params.showprice == 1">
              <!-- :style="{color:res.style.pricecolor}" -->
              <text style="font-size: 28upx;" class="flex">¥{{item.price}}</text>
              <!-- <text style="font-size: 18upx;margin-left: -90upx;color: #ccc;text-decoration:line-through" class="flex">¥{{item.productprice}}</text> -->
              <!-- <view class="webkit">
								<image src="../../static/jifen.png" mode="" style="width: 36upx;height: 36upx;display: block;"></image>
								<text style="color:red;display: block;">{{item.jfbl}}%</text>
							</view> -->
            </view>
          </view>
        </view>
      </view>
    </view>

    <!-- update -->
    <view class="mask" :class="show" @touchmove.stop.prevent="hide"></view>
    <view class="mask" :class="show2" @touchmove.stop.prevent="hide"></view>
    <view class="gengxing" :class="show2" :style="{pointerEvents:pointerevents}">
      <image src="../../static/update_bg3.png"
        style="width: 480upx;height: 732upx;position: absolute;bottom: 0;z-index: 2;"></image>
      <!-- 更新进度条 -->
      <view v-if="show8 == 0">
        <view
          style="background: rgba(255, 0, 0, 0.2);width: 480upx;height: 100upx;position: absolute;z-index: 9999;bottom: 0;"
          :style="{'right':right}"></view>
        <view class="title">发现新版本<text>v{{version}}</text></view>
        <view style="position:absolute;bottom:310upx;width:100%;text-align:center;z-index: 999;color: #db3737;">
          {{newtext}}
        </view>
        <view style="position:absolute;top:460upx;width:100%;text-align:center;">

        </view>
        <button class="dl" @click="download" v-if="link == '4G'">{{dlbtn}}</button>
        <button class="dl" v-else>{{dlbtn}}</button>
      </view>
    </view>

  </view>
</template>

<script>
  import uniIcon from '@/components/uni-icon.vue'
  import uniCountdown from '@/components/uni-countdown/uni-countdown.vue'
  import BottomImageMenu from '@/components/bottom-mask/bottom-mask.js'
  // #ifdef APP-PLUS
  var bottomImageMenu = new BottomImageMenu(() => {})
  // #endif
  export default {
    components: {
      uniIcon,
      uniCountdown
    },
    data() {
      return {
        system: {}, // 获取手机系统信息
        data: [],
        appversion: '',
        version: '',
        show: '',
        show2: "",
        show3: 'show',
        link: "",
        dlbtn: "",
        newtext: "",
        right: '100%',
        titleNViewBackground: '', //轮播图区域
        swiperCurrent: 0,
        swiperLength: 0,
        goodsList: [],
        backgroundColor: 'transpant',
        pointerevents: 'auto',
        ad: false,
        adv: {},
        autoclose: '',
        picturew: [],
        picturew_row: '',
        message: '',
        helpmoney: '',
        show8: '',

        navbarHeight: 44,
        marginTops: 0,
        versionUrl: '',
      };
    },
    onReady: function() {
      this.show8 = 0
    },
    onLoad: function() {
      let that = this
      // #ifdef  H5
      this.navbarHeight = 70
      // #endif
      setTimeout(() => {
        // console.log(this.$refs.navbars)
        uni.getSystemInfo({
          success: function(res) {
            console.log(res.statusBarHeight);
            if (res.statusBarHeight) that.marginTops = res.statusBarHeight - 20
          }
        });
      }, 0)

      uni.getSystemInfo({
        success: function(res) {
          that.system = res
          // console.log(res.windowWidth);
          // console.log(res.statusBarHeight);
        }
      });

      this.getmsg()
      let o = this
      uni.request({
        url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&app=1',
        success: res => {
          this.data = res.data
          // 处理广告栏数据
          // this.adv = res.data.adv
          // if (this.adv.data != null) {
          // 	this.ad = true
          // 	this.autoclose = res.data.adv.params.autoclose
          // 	if(this.adv.status == 1) {
          // 		setTimeout(function() {
          // 			o.show3 = ''
          // 		}, o.autoclose*1000);
          // 	}
          // } else {
          // 	this.ad = false
          // }

          for (var i in this.data) {
            if (this.data[i].id == 'menu') {
              if (this.data[i].data_temp == undefined) {
                this.data[i].style.width = 375 / this.data[i].style.rownum + 'px'
              }
            }

            if (this.data[i].id == 'picturew') {
              let obj = this.data[i].data
              var arr = []
              for (let i in obj) {
                let o = {};
                o[i] = obj[i];
                arr.push(o[i])
              }
              // this.data[i].data = arr
              // 换一个数组存储渲染
              this.picturew = arr
              this.picturew_row = this.data[i].params.row
            }

            if (this.data[i].id == 'banner') {
              let a = this.data[i].data
              var count = 0;
              for (var i in a) {
                if (a.hasOwnProperty(i)) {
                  count++;
                }
              }
              this.swiperLength = count
              this.titleNViewBackground = '#ff3300';
            }
          }

        },
        fail: () => {},
        complete: () => {}
      });
      if (uni.getSystemInfoSync().platform === 'android') {
        uni.request({
          url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.getappversion&app=1',
          method: 'POST',
          success: res => {
            this.versionUrl = res.data.url
            //#ifdef APP-PLUS
            var edition = plus.runtime.version //获取当前版本号：1.0.1

            //将版本号转变为101格式
            edition = edition.split(".")
            var ary = ''
            for (var i in edition) {
              ary += edition[i]
            }
            // if (0) { //判断如果版本低于服务器版本
            if (res.data.version != ary) { //判断如果版本低于服务器版本
              this.ad = false // 更新时阻止弹出系统广告
              //将版本号101转变为1.0.1格式
              var newversion = ''
              for (var i in res.data.version) {
                newversion += res.data.version[i] + '.'
              }
              this.version = newversion.slice(0, newversion.length - 1)
              //------------------
              this.show2 = 'show' //蒙版出现
              bottomImageMenu.show() // 遮挡底部菜单栏的蒙版
              if (plus.networkinfo.getCurrentType() != 3) { //如果不是WIFI
                this.link = '4G'
                this.dlbtn = '使用流量下载'
                this.newtext = '您当前未使用wifi，已停止下载'
                var nowlink = setInterval(() => {
                  if (plus.networkinfo.getCurrentType() == 3) {
                    clearInterval(nowlink)
                    this.download() //下载
                  }
                }, 2000)
              } else {
                this.download() //下载
              }
            }
            //#endif
          },
          fail: () => {},
          complete: () => {},
        });
      }
      if (uni.getSystemInfoSync().platform === 'ios') {
        uni.request({
          url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.getappversion&app=1',
          method: 'POST',
          success: res => {
            //#ifdef APP-PLUS
            var edition = plus.runtime.version //获取当前版本号：1.0.1

            //将版本号转变为101格式
            edition = edition.split(".")
            var ary = ''
            for (var i in edition) {
              ary += edition[i]
            }
            // if (res.data.version > ary) { //判断如果版本低于服务器版本
            if (res.data.version != ary) { //判断如果版本低于服务器版本
              this.ad = false // 更新时阻止弹出系统广告
              //将版本号101转变为1.0.1格式
              var newversion = ''
              for (var i in res.data.version) {
                newversion += res.data.version[i] + '.'
              }
              this.version = newversion.slice(0, newversion.length - 1)
              //------------------
              uni.showModal({
                title: "更新",
                content: '有新的功能推送哦~',
                success: function(res) {
                  if (res.confirm) {
                    plus.runtime.openURL(
                      this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=account.download'
                    )
                  } else if (res.cancel) {
                    // console.log('用户点击取消');
                  }
                }
              })
            }
            //#endif
          },
          fail: () => {},
          complete: () => {},
        });
      }
    },
    methods: {
      getmsg() {
        uni.request({
          url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=tzz.helpmoney&app=1',
          method: 'POST',
          success: res => {
            this.message = res.data.message
            this.helpmoney = res.data.helpmoney
          },
          fail: () => {},
          complete: () => {},
        });
      },
      // 页面滚动事件
      // onPageScroll(){
      // 	// if (scrollTop<=100) {
      // 	// 	this.backgroundColor = 'black'
      // 	// }
      // 	this.backgroundColor = '#C45952'
      // },
      download() {
        this.pointerevents = 'none'
        this.link = 'wifi'
        this.dlbtn = '正在下载 0%'
        this.newtext = '正在后台下载，请稍后'
        let _this = this
        var downToak = plus.downloader.createDownload(this.versionUrl, { //拿到下载任务的对象
          filename: '_doc/update/'
        }, function(d, status) {
          plus.nativeUI.closeWaiting();
          if (status == 200) { //在回调中根据状态 进行操作
            plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), {}, {}, function(error) {
              uni.showToast({
                title: '安装失败',
                mask: false,
                duration: 1500
              });
            })
          } else {
            app.alert("配置出错,请检查网络链接！");
          }
        });
        downToak.start(); // 开启下载的任务
        var prg = 0;
        downToak.addEventListener("statechanged", function(task, status) { //给下载任务设置一个监听 并根据状态  做操作
          switch (task.state) {
            case 1:
              break;
            case 2:
              break;
            case 3:
              prg = parseInt(parseFloat(task.downloadedSize) / parseFloat(task.totalSize) * 100);
              _this.dlbtn = '正在下载 ' + prg + '%'
              _this.right = 100 - Number(prg) + '%'
              break;
            case 4:
              break;
          }
        });
      },
      //轮播图切换修改背景色
      swiperChange(e) {
        const index = e.detail.current;
        this.swiperCurrent = index;
        var arr = []
        for (let i in this.data[1].data) {
          arr.push(this.data[1].data[i]); //属性
          //arr.push(this.data[1].data[i]); //值
        }
        this.titleNViewBackground = arr[index].background;
      },
      fenleijump(fenlei) {
        uni.navigateTo({
          url: '../goods/goods?cate=' + fenlei
        });
      },
      hide() {
        this.newLogin = ''
        this.show = ''
      },
      hide1() {
        this.show3 = ''
      },
      searchgoGoods() {
        uni.reLaunch({
          url: '../shop/category'
        })
      },
      jumpgo(e) {
        uni.navigateTo({
          url: e.currentTarget.dataset.src
        });
      },
      jump() {
        uni.showModal({
          title: '提示',
          content: '功能即将开放',
          showCancel: false,
          confirmColor: "#DD524D",
          success() {
            return
          }
        })
      },
      jumptomenu(item) {

        if (item.linkurl == "" || item.linkurl == undefined) {
          uni.showModal({
            title: '提示',
            content: '即将开放',
            showCancel: false,
            confirmColor: "#DD524D",
            success() {
              return
            }
          })
          return
        }
        // 跳转到文章页
        if (item.linkurl == "../media/media") {
          uni.navigateTo({
            url: '../media/media'
          });
          return
        }
        if (item.linkurl.indexOf("../commission/qrcode/invite_code") != -1) {
          uni.navigateTo({
            url: '../commission/qrcode/invite_code'
          });
          return
        }
        if (item.linkurl.indexOf("http") != -1) {
          // #ifdef APP-PLUS
          var urlStr = encodeURI(item.linkurl)
          plus.runtime.openURL(urlStr)
          // #endif
          // #ifdef H5
          window.open(item.linkurl)
          // #endif
          return
        }
        item = item.linkurl
        let obj = {};
        let arr1 = item.split("?");
        let arr2 = arr1[1].split("&");
        for (let i = 0; i < arr2.length; i++) {
          let res = arr2[i].split("=");
          obj[res[0]] = res[1];
        }
        item = obj
        // 跳转到自定义页面
        if (item.r == "diypage") {
          uni.navigateTo({
            url: '../goods/spree/spree?id=' + item.id
          });
        }
        if (item.r == "goods") {
          uni.navigateTo({
            url: '../goods/goods?cate=' + item.cate
          });
        }
        if (item.r == "sign") {
          uni.navigateTo({
            url: '../member/sign/sign'
          });
        }

        // uni.navigateTo({
        // 	url: '../goods/goods?cate=' + item
        // });
      },
      jumpto(item) {
        item = item.linkurl
        let obj = {};
        let arr1 = item.split("?");
        let arr2 = arr1[1].split("&");
        for (let i = 0; i < arr2.length; i++) {
          let res = arr2[i].split("=");
          obj[res[0]] = res[1];
        }
        item = obj.cate
        if (item == '' || item == undefined) {
          uni.navigateTo({
            url: '../commission/qrcode/invite_code'
          });
        } else {
          uni.navigateTo({
            url: '../goods/goods?cate=' + item
          });
        }

      },
      jumptomedia() {
        uni.navigateTo({
          url: '../media/media'
        });
      },
      jumpgoods(e) {
        uni.navigateTo({
          url: '../goods/detail?goodsid=' + e.currentTarget.dataset.id
        });
      },
      searchGoods(e) {
        uni.navigateTo({
          url: '../goods/goods?keywords=' + e.mp.detail.value
        });
      },
      jump_1() {
        uni.navigateTo({
          url: '../goods/spree/spree'
        });
      },
      jump_2() {
        uni.navigateTo({
          url: '../goods/contract'
        });
      },
      jump_3() {
        uni.navigateTo({
          url: '../member/sign/sign'
        });
      },
      jump_4() {
        uni.navigateTo({
          url: '../goods/detail?goodsid=248'
        });
      }
    }
  }
</script>

<style lang="scss">
  page {
    background: #b5c3c7; // 页面的整体背景色
  }

  .container {
    // width: 100%;
    // height: 800rpx;
    // background: url(/static/images/home/home_bg.png) no-repeat 0 0;
    // background-size: cover;
  }

  .m-t {
    margin-top: 16upx;
  }

  /* 头部 轮播图 */
  .carousel-section {
    position: relative;

    .abso_image {
      width: 100%;
      position: absolute;
      bottom: -34rpx;
      left: 0;
      z-index: 99;
    }

    // margin-top: 20upx;
    .titleNview-placing {
      height: var(--status-bar-height);
      padding-top: 44px;
      box-sizing: content-box;
    }

    .titleNview-background {
      // background: #BE473F; //轮播图后面暂时的静态背景色
      opacity: 0.9;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 426upx;
      transition: .4s;
    }
  }

  .carousel {
    width: 100%;
    height: 310upx;
    text-align: center;

    .carousel-item {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    image {
      margin: 4% 0;
      width: 90%; // 设置 轮播图片宽度
      height: 92%;
    }
  }

  .swiper-dots {
    display: flex;
    position: absolute;
    left: 60upx;
    bottom: 15upx;
    width: 72upx;
    height: 36upx;
    z-index: 999;
    background-image: url();
    background-size: 100% 100%;

    .num {
      width: 36upx;
      height: 36upx;
      border-radius: 50px;
      font-size: 24upx;
      color: #fff;
      text-align: center;
      line-height: 36upx;
    }

    .sign {
      position: absolute;
      top: 0;
      left: 50%;
      line-height: 36upx;
      font-size: 12upx;
      color: #fff;
      transform: translateX(-50%);
    }
  }

  /* 分类 */
  .cate-section {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    padding: 30upx 22upx;
    background: #fff;

    .cate-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      // font-size: $font-sm + 2upx;
      // color: $font-color-dark;
    }

    /* 原图标颜色太深,不想改图了,所以加了透明度 */
    image {
      width: 88upx;
      height: 88upx;
      margin-bottom: 14upx;
      border-radius: 50%;
      opacity: .7;
      box-shadow: 0px 2px 8px 3px rgba(235,235,235,0.4);
    }
  }

  .ad-1 {
    width: 100%;
    height: 210upx;
    padding: 10upx 0;
    background: #fff;

    image {
      width: 100%;
      height: 100%;
    }
  }

  .p_father {
    width: 100%;
    height: 330upx;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16upx;
  }

  .p_left {
    margin: 0 10upx;
    width: 40%;
    flex: 1;
  }

  .p_left image {
    width: 100%;
    height: 100%;
  }

  .p_right {
    margin: 0 10upx;
    width: 40%;
    flex: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
  }

  .img_top {
    flex: 1;
    height: 100%;
    // height: 170upx;
    width: 100%;
  }

  .img_top image {
    width: 98%;
    height: 98%;
  }

  .img_bottom {
    flex: 1;
    height: 100%;
    // height: 170upx;
    width: 100%;
    display: flex;
  }

  .img_bottom view {
    flex: 1;
    width: 50%;
    line-height: 1;
  }

  .img_bottom view:nth-child(1) image {
    width: 98%;
    height: 98%;
    // margin: 0 4% 4% 0;
  }

  .img_bottom view:nth-child(2) image {
    width: 98%;
    height: 98%;
    // margin: 0 0% 4% 4%;
  }

  .tab_choose {
    height: 100upx;
    display: flex;
    background-color: #fff;
    color: #b71c24;
  }

  .padleft {
    color: #333;
    padding-left: 4upx;
  }

  .menu_son {
    line-height: 100upx;
    flex: 1;
    text-align: center;
  }

  .flexbox {
    display: flex;
    flex-wrap: wrap;
  }

  .flexboxson {
    width: 25%;
  }

  .block {
    padding: 8upx;
  }

  .item {
    float: left;
    width: 50%;
    padding: 10upx;
    box-sizing: border-box;
  }

  .one .item {
    width: 100%;
  }

  .three .item {
    width: 33.33%;
  }

  .triangle {
    width: 100%;
    height: 346upx;
    display: block;
  }

  .one .triangle {
    height: 714upx
  }

  .three .triangle {
    height: 224upx
  }

  .detail {
    background: #fff;
    padding: 20upx 12upx;
  }

  .name {
    height: 68upx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 24upx;
    line-height: 36upx;
  }

  .price text {
    display: block;
    line-height: 40upx;
  }

  .price {
    margin-top: 12upx;
    color: #b71c24;
  }

  .mask {
    position: fixed;
    z-index: 998;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .6);
  }

  .mask,
  .tips {
    display: none;
  }

  .mask.show,
  .gengxing.show {
    display: block !important;
  }

  .mask4 {
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    background: #fff;
  }

  .gengxing {
    position: fixed;
    z-index: 999;
    width: 480upx;
    height: 738upx;
    top: 50%;
    left: 50%;
    margin-left: -240upx;
    margin-top: -380upx;
    background-size: cover;
    display: none;
    overflow: hidden;
  }

  .gengxing .title {
    position: absolute;
    top: 340upx;
    text-align: center;
    color: #db3737;
    font-size: 40upx;
    font-weight: 600;
    width: 220upx;
    left: 50%;
    margin-left: -110upx;
    line-height: 44upx;
    z-index: 999;
  }

  .gengxing .title text {
    font-weight: initial;
    font-size: 24upx;
    color: #fff;
    background: #db3737;
    border-radius: 100upx;
    padding: 0 10upx;
    position: absolute;
    line-height: 36upx;
    bottom: 0;
    left: 100%;
    z-index: 999;
  }

  .dl {
    position: absolute;
    bottom: 0;
    background: transparent;
    font-size: 34upx;
    width: 100%;
    color: #fff;
    line-height: 100upx;
    z-index: 999;
  }

  .navbars {
    width: 100%;
    color: #FFFFFF;
    padding: 0 30rpx;

    view {
      font-size: 20rpx;
      color: #BBAF92;
    }
  }
</style>
